#!/bin/sh

## hyphop ##

#= make all images 

#khadas-edge-captain-rk3399
#khadas-edge-rk3399
#khadas-edge-v-rk3399

PR=$(dirname $0)
RP=$(realpath $PR)

cd "$PR" || exit 1

[ "$CONFIGS" ] || CONFIGS="$@"

[ "$CONFIGS" ] || \
CONFIGS="khadas-vim khadas-vim2 khadas-vim3 khadas-vim3l khadas-edge-v-rk3399"

for D in $CONFIGS ; do
    echo $D
    export DEF_CONFIG="${D}_defconfig"

    . ./make.inc

    ./make re || {
	echo "[w] last fail $?"
	exit 1
    }

    [ "$NOP" ] && {
	echo "[i] NOP mode!!!"
	continue
    }

    BOARDS=$BOARD ./make_last_env

    [ "$VENDOR" = "Amlogic" ] && {
    ./make_aml_burn_images $BOARD
    }

    echo "[i] $BOARD DONE"

done

[ "$NOP" ] && exit

./make_krescue_image
./make_post
